package StudyCode.summary.mydatetime;

import java.time.*;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class DifferenceAddingPeriodDuration {
	public static void main(String[] args) {
		ZoneId cn = ZoneId.of("Asia/Shanghai");
		LocalDateTime ldt = LocalDateTime.of(2019, Month.MARCH, 10, 7, 30);
		ZonedDateTime zdt1 = ZonedDateTime.of(ldt, cn);
		Period p1 = Period.ofDays(1);
		Duration d1 = Duration.ofHours(24);

		ZonedDateTime zdt2 = zdt1.plus(p1);// 加一天
		ZonedDateTime zdt3 = zdt1.plus(d1); // 加24小时

		System.out.println("开始日期: " + zdt1);
		System.out.println("1天后(使用period): " + zdt2);
		System.out.println("24小时后(duration): " + zdt3);
	}
}
